package com.example.demo.service;

import com.example.demo.entity.UserInfo;
import com.example.demo.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DELL
 * Date: 2023-06-06
 * Time: 17:13
 */
@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    public int reg(UserInfo userInfo) {
        return userMapper.reg(userInfo);
    }

    public UserInfo selectByUsername(String username) {
        return userMapper.selectByUsername(username);
    }

    public int reg2(UserInfo userInfo) {
        return userMapper.reg2(userInfo);
    }

    public UserInfo login(String username) {
        return userMapper.login(username);
    }

    public UserInfo selectByUsernameAndEmail(String username, String email) {
        return userMapper.selectByUsernameAndEmail(username, email);
    }

    public int updatePassword(String username, String email, String password) {
        return userMapper.updatePassword(username, email, password);
    }

    public int filePath(String image_path, Integer id) {
        return userMapper.filePath(image_path, id);
    }

    public UserInfo getImagePath(Integer id) {
        return userMapper.getImagePath(id);
    }

    public int revisePassword(Integer id, String newpassword) {
        return userMapper.revisePassword(id, newpassword);
    }
}
